package com.itheima.controller;

import com.itheima.domain.db.Question;
import com.itheima.service.db.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/question")
public class QuestionController {

    @Autowired
    private QuestionService questionService;

    @GetMapping("/findByUserId")
    public Question findByUserIdQ(Long userId) {
        return questionService.findByUserId(userId);
    }

    @PostMapping("/save")
    public void save(@RequestBody Question question) {
        questionService.save(question);
    }

    @PutMapping("/update")
    public void update(@RequestBody Question question) {
        questionService.update(question);
    }
}